﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CodeStash.Common.Enums;
using System.Runtime.Serialization;

namespace CodeStash.Common.DTOS
{
    [DataContract]
    public class JSONCodeSnippet
    {
        //With Id know constructor
        public JSONCodeSnippet
            (
                int codeSnippetId,
                string actualCode,
                int categoryId,
                string categoryName,
                int languageId,
                string language,
                string tags,
                string description,
                string title,
                int? groupId,
                string groupName,
                CodeSnippetVisibility visibility,
                int views, 
                int rating, 
                int totalRatings
            ) : this(actualCode, categoryId, categoryName, languageId,
                language, tags, description, title, groupId, groupName, visibility, views, rating, totalRatings)
        {
            this.CodeSnippetId = codeSnippetId;
        }


        public JSONCodeSnippet
            (
                string actualCode,
                int categoryId,
                string categoryName,
                int languageId,
                string language,
                string tags,
                string description,
                string title,
                int? groupId,
                string groupName,
                CodeSnippetVisibility visibility,
                int views,
                int rating,
                int totalRatings
            )
        {
            this.ActualCode = actualCode;
            this.CategoryId = categoryId;
            this.CategoryName = categoryName;
            this.LanguageId = languageId;
            this.Language = language;
            this.Tags = tags;
            this.Description = description;
            this.Title = title;
            this.GroupId = groupId;
            this.GroupName = groupName;
            this.Visibility = visibility;
            this.Views = views;
            this.Rating = rating;
            this.TotalRatings = totalRatings;
        }


        [DataMember]
        public int CodeSnippetId { get; private set; }

        [DataMember]
        public string ActualCode { get; private set; }

        [DataMember]
        public int CategoryId { get; private set; }

        [DataMember]
        public string CategoryName { get; private set; }

        [DataMember]
        public int LanguageId { get; private set; }

        [DataMember]
        public string Language { get; private set; }

        [DataMember]
        public string Tags { get; private set; }

        [DataMember]
        public string Description { get; private set; }

        [DataMember]
        public string Title { get; private set; }

        [DataMember]
        public int? GroupId { get; private set; }

        [DataMember]
        public string GroupName { get; private set; }

        [DataMember]
        public CodeSnippetVisibility Visibility { get; private set; }

        [DataMember]
        public int Views { get; set; }

        [DataMember]
        public int Rating { get; set; }

        [DataMember]
        public int TotalRatings { get; set; }
    }

}
